#!/bin/bash

# default input
test=LogXmlDomXtjTest.php;
test2=LogXmlStringSimpleTest.php

# Ubuntu variables
devTestDir=~/Documents/Code/log-xml/tests
phpunit=phpunit
pear=pear
sudo=sudo
# Cygwin
if [ "$OSTYPE" == "cygwin" ]; then
    devTestDir=/cygdrive/c/Users/Vlad/IdeaProjects/Log-XML/tests
    phpunit=phpunit.bat
    pear=pear.bat
    sudo=
fi
pushd $devTestDir
$phpunit --verbose $test
$phpunit --verbose $test2
cd ..
$pear package 2>/dev/null
$sudo $pear install -f Log_XML-0.4.0.tgz
pushd `$pear config-get test_dir`/Log_XML/tests
$phpunit --verbose $test
$phpunit --verbose $test2

if [ "$sudo" == "sudo" ]; then
    $sudo $phpunit --verbose $test
    $sudo $phpunit --verbose $test2
fi